package util

import (
	"github.com/gin-gonic/gin"
)

// cookie获取
func CookieGet(c *gin.Context, name, def string) (value string) {
	// 从请求中获取所有 cookie
	cookies := c.Request.Cookies()

	for _, cookie := range cookies {
		if cookie.Name == name {
			value = cookie.Value
			return
		}
	}
	return
}
